﻿Imports System.Data.SqlClient
Imports Crystal.Common.Model
Imports Crystal.CLL


Public Class ClientManagement
    Public Shared strConfiguration As String = CommonCLL.mstrConnectionstring

    Public Enum ClientMenu
        ClientName = 1
        Listing = 2
        Ratio = 3
        ISIO = 4
        SEDOL = 5
        CUSIP = 6
        Sector = 7
        Industry = 8
        MarketCap = 9
        CapGroup = 10
        PrimaryExchange = 11
        Street1 = 12
        Street2 = 13
        City = 14
        State = 15
        Country = 16
        Region = 17
        Mobile = 18
        Telephone = 19
        Fax = 20
        Email = 21
        Notes = 22
    End Enum

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="intSearchin"></param>
    ''' <param name="strLookFor"></param>
    ''' <param name="Criteria"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function SearchClients(ByVal intSearchin As Integer, ByVal strLookFor As String, ByVal Criteria As Short) As IDataReader
        Dim eReturnVal As ExecutionResult = Nothing
        Dim param(2) As SqlParameter
        param(0) = New SqlParameter("@SearchIn", intSearchin)
        param(1) = New SqlParameter("@LookFor", strLookFor)
        param(2) = New SqlParameter("@SearchCriteria", Criteria)
        eReturnVal = CoreFunctions.Execute(strConfiguration, "CR_sp_CLT_SearchClient", CommandType.StoredProcedure, ReturnTypes.DataReader, param)
        Return CType(eReturnVal.ResultObject, IDataReader)
    End Function

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="clientID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function GetParticularClient(ByVal clientID As Integer) As DataSet
        Dim eReturnVal As ExecutionResult = Nothing
        Dim param(0) As SqlParameter
        param(0) = New SqlParameter("@ClientID", clientID)
        eReturnVal = CoreFunctions.Execute(strConfiguration, "CR_sp_CLT_GetParticularClient", CommandType.StoredProcedure, ReturnTypes.DataSet, param)
        Return CType(eReturnVal.ResultObject, DataSet)
    End Function

    
End Class
